package com.softserve.academy.food.model;

import com.softserve.academy.food.entity.eUser;

public class mUserCredentials 
{
	private int id;
	private String login;
	private String pass;
	private String role="ROLE_USER";
	
	public mUserCredentials()
	{
	}
	
	public mUserCredentials( eUser user )
	{
		id = user.getId();
		login = user.getLogin();
		pass = user.getPass();
		role = user.getRole();
	}

	public int getId() 
	{
		return id;
	}

	public void setId( int id ) 
	{
		this.id = id;
	}

	public String getLogin() 
	{
		return login;
	}

	public void setLogin( String login ) 
	{
		this.login = login;
	}

	public String getPass() 
	{
		return pass;
	}

	public void setPass( String pass ) 
	{
		this.pass = pass;
	}

	public String getRole() 
	{
		return role;
	}

	public void setRole(String role) 
	{
		this.role = role;
	}

	@Override
	public int hashCode() 
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		result = prime * result + ((login == null) ? 0 : login.hashCode());
		result = prime * result + ((pass == null) ? 0 : pass.hashCode());
		result = prime * result + ((role == null) ? 0 : role.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) 
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof mUserCredentials))
			return false;
		mUserCredentials other = (mUserCredentials) obj;
		if (id != other.id)
			return false;
		if (login == null) 
		{
			if (other.login != null)
				return false;
		} 
		else if (!login.equals(other.login))
			return false;
		if (pass == null) 
		{
			if (other.pass != null)
				return false;
		} 
		else if (!pass.equals(other.pass))
			return false;
		if (role == null) 
		{
			if (other.role != null)
				return false;
		} else if (!role.equals(other.role))
			return false;
		return true;
	}

	@Override
	public String toString() 
	{
		return "mUserCredentials [id=" + id + ", login=" + login + ", pass="
				+ pass + ", role=" + role + "]";
	}
	

}
